﻿@{
    ViewBag.Title = "AdminNewsList";
}

<h2>News administration</h2>
<p>
    @Html.ActionLink("Create new", "Create")
</p>
<div id="hide_show_update" class="hide_show_class">
    <span>Update peoples</span>
    <div id="hsUpdatePanel" class="hide_showbutton_base hide_showbutton_ico_hidden" data-bind="click: hsUpdatePanel">&nbsp;</div>
</div>
<div class="upadatepanel" id="updatePanel">
    <div data-bind="with: current">
        <div>
            <label for="titleEditor">Titel</label>
        </div>
        <div>
            <input id="titleEditor" type="text" data-bind="value:Title"/>
        </div>
        <div>
            <label for="textEditor">Text</label>
        </div>
        <div>
            <textarea id="textEditor" rows="4" cols="50" data-bind="value:Text"></textarea>
        </div>
    </div>
    <button data-bind="click:updateCurrentItem">Update</button>
    <button data-bind="click:cancelChanges">Cancel</button>
</div>
<div id="hide_show_create" class="hide_show_class">
    <span>Create peoples</span>
    <div id="hsCreatePanel" class="hide_showbutton_base hide_showbutton_ico_hidden" data-bind="click: hsCreatePanel">&nbsp;</div>
</div>
<div class="upadatepanel" id="createPanel">
    <div data-bind="with: current">
    <div>
        <label for="titleEditor">Titel</label>
    </div>
    <div>
        <input id="titleCreateor" type="text"/>
    </div>
    <div>
        <label for="textEditor">Text</label>
    </div>
        <div>
            <textarea id="textCreateor" rows="4" cols="50"></textarea>
        </div>
     </div>
    <button data-bind="click:createItem">Create</button>
</div>
<div data-bind="foreach:news">
    <div class="newslistitems">
        <h4 data-bind="text:Title"></h4>
        <div data-bind="text:Text"></div>
        <div data-bind="text:Created"></div>
        <a href="#" data-bind="click: $parent.removeItem">Remove</a>
        <a href="#" data-bind="click: $parent.updateItem">Update</a>
    </div>
</div>
